package com.czy.owner.api;

import com.czy.owner.db.UserHelper;
import com.czy.owner.global.Constants;
import com.czy.owner.net.api.BaseApi;
import com.czy.owner.net.listener.HttpOnNextListener;
import com.trello.rxlifecycle.components.support.RxAppCompatActivity;

import retrofit2.Retrofit;
import rx.Observable;

/**
 * Created by hedepu on 2017/11/1.
 */

public class OwneiInsListApi extends BaseApi {
    private String session;
    private String ownerId;
    private String size;
    private String page;


    public OwneiInsListApi(HttpOnNextListener listener, RxAppCompatActivity rxAppCompatActivity) {
        super(listener, rxAppCompatActivity);
        setCache(false);
        setCookieNetWorkTime(0);
        setMothed(UserHelper.getInstance().getUserAccount() + Constants.OWN_GETOWNERINS);//相当于缓存保存的Key
        setCookieNoNetWorkTime(0);//无网缓存0天
        setShowProgress(false);
    }

    public String getSession() {
        return session;
    }

    public void setSession(String session) {
        this.session = session;
    }

    public String getSize() {
        return size;
    }

    public void setSize(String size) {
        this.size = size;
    }

    public String getPage() {
        return page;
    }

    public void setPage(String page) {
        this.page = page;
    }

    public String getOwnerId() {
        return ownerId;
    }

    public void setOwnerId(String ownerId) {
        this.ownerId = ownerId;
    }

    @Override
    public Observable getObservable(Retrofit retrofit) {
        HttpPostService service = retrofit.create(HttpPostService.class);
        return service.getOwnerIns(getSession(), getOwnerId(), getPage(), getSize());
    }
}
